package com.ridu.project.beshid.controller;

import com.alibaba.fastjson.JSONObject;
import com.ridu.project.beshid.api.GeneralResponse;
import com.ridu.project.beshid.service.ContentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by Administrator on 2017/2/13.
 */
@Controller
@RequestMapping(value = "content",produces = "application/json")
@Slf4j
public class ContentController extends BaseController {

    @Autowired
    private ContentService service;

    @RequestMapping(value = "redirectSys",method = RequestMethod.POST)
    public String redirectSys(){
        return "content";
    }

    @RequestMapping(value = "getContent")
    @ResponseBody
    public GeneralResponse getContent(@RequestParam int currentPage, @RequestParam int pageSize, String startTime, String endTime, String accessToken){
        return service.findAll(currentPage,pageSize,startTime,endTime, accessToken);
    }

    @RequestMapping(value = "getDetail")
    @ResponseBody
    public GeneralResponse getDetail(@RequestParam String transactionHash){
        return service.getDetail(transactionHash);
    }

}

